package hotel.board.circuit;

import hotel.hotel.IProperty;

public class Case implements ICase {
	
	// ATTRIBUTS

	private final IProperty rightSide;
	private final IProperty leftSide;
	private final CaseStates state;

	protected boolean rightEntry;
	protected boolean leftEntry;
	
	// CONSTRUCTEUR
	
	public Case(IProperty right, IProperty left, CaseStates s) {
		rightSide = right;
		leftSide = left;
		state = s;
		rightEntry = false;
		leftEntry = false;
	}
	
	// REQUETES

	@Override
	public IProperty getProperty(int side) {
		switch (side) {
		case RIGHT_SIDE: return rightSide;
		case LEFT_SIDE: return leftSide;
		}
		throw new IllegalArgumentException();
	}

	@Override
	public CaseStates getState() {
		return state;
	}

	@Override
	public boolean hasEntry(int side) {
		switch (side) {
		case RIGHT_SIDE: return rightEntry;
		case LEFT_SIDE: return leftEntry;
		}
		throw new IllegalArgumentException();
	}

}
